Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

439
Views
how can assign value "$event" to template variable?

since I use several similar mat-inputs inside a template form, I define an ng-template for these mat-inputs and refer to it via *ngTemplateOutlet and also pass related data to the template as bellow:

<ng-template #formFieldInput let-hintMsg="hintMsg" let-lable="lable" let-        dataBinding="dataBinding">
  <mat-form-field appearance="outline" class="fa">
    <mat-label>{{lable}}</mat-label>
    <input matInput type="text"  name="nationalCode"
        [(ngModel)]="dataBinding" [disabled]="!personalInfoEdit"/>
    <mat-hint *ngIf="personalInfoEdit">{{hintMsg}}</mat-hint>
  </mat-form-field>
</ng-template>

// ... 

<ng-container *ngTemplateOutlet="formFieldInput; context:{hintMsg: 'Enter National Code', lable: 'National Code', dataBinding: profileDetails.nationalCode} ">
</ng-container>

but I got this error:

 [webpack-dev-middleware] Error: Cannot assign value "$event" to template variable "dataBinding". Template variables are read-only.

how can fix this problem? best regards

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!